package registry

import "context"

type YRegistryKey struct{}

func WithCtx(ctx context.Context, registry IRegistry) context.Context {
	return context.WithValue(ctx, YRegistryKey{}, registry)
}

func FromCtx(ctx context.Context) (IRegistry, bool) {
	v := ctx.Value(YRegistryKey{})
	if v == nil {
		return nil, false
	}

	r, ok := v.(IRegistry)
	return r, ok
}
